package com.hz.house.controller.home;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.hz.house.bean.vo.UnitReviewInfo;
import com.hz.house.service.home.BuildingUnitReviewService;
import com.hz.house.token.CurrentUser;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@Api(value = "户型评测功能相关接口")
@RestController
@RequestMapping("/api/v2/unitReview")
public class BuildingUnitReviewController {
	
	@Autowired
	private BuildingUnitReviewService buildingUnitReviewService;
	
	@ApiOperation(value = "申请评测户型")
	@PostMapping("/applyReview")
	public Object applyReview(@RequestBody UnitReviewInfo info) {
		return buildingUnitReviewService.applyReview(info, CurrentUser.getCurrentUserId());
	}
	
	@ApiOperation(value = "拉取户型评测列表及检索")
	@GetMapping("/getReviewList")
	public Object getUnitReviewList(Integer page,String keyword) {
		return this.buildingUnitReviewService.getUnitReviewList(page, keyword);
	}
	
	@ApiOperation(value = "获取户型评测详情数据")
	@GetMapping("/getRwuDetail")
	public Object getUnitReviewDetail(Integer reviewId) {
		return this.buildingUnitReviewService.getUnitReviewDetail(reviewId);
	}
	
}
